package com.wty.learnsping.servletConfig;


import com.wty.learnsping.filter.MyFilter1;
import com.wty.learnsping.filter.MyFilter2;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

//@Configuration
public class filterConfig  {

    @Bean
    public FilterRegistrationBean filterRegistrationBean1(){
        FilterRegistrationBean myFilter=new FilterRegistrationBean(new MyFilter1());
        myFilter.addServletNames("myFilter1");
        myFilter.addUrlPatterns("*.filter");
        myFilter.setOrder(1);//设置filter执行顺序
        return myFilter;
    }

    @Bean
    public FilterRegistrationBean filterRegistrationBean2(){
        FilterRegistrationBean myFilter=new FilterRegistrationBean(new MyFilter2());
        myFilter.addServletNames("myFilter2");
        myFilter.addUrlPatterns("*.filter");
        myFilter.setOrder(2);//设置filter执行顺序
        return myFilter;
    }

}
